FROM jenkins/inbound-agent:alpine-jdk11
LABEL auther="hjl@94qq.com"
ENV LANG=en_US.UTF-8

USER root

ENV JENKINS_AGENT_WORKDIR=/home/jenkins/agent

RUN set -ux; \
  cp /etc/apk/repositories /etc/apk/repositories.bak \
  && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
  && apk update \
  && apk add curl python3 wget sshpass rsync nfs-utils gcc make musl-dev \
  && rm -rf /var/cache/apk/*


ADD --chown=root:root bin/docker/docker /usr/bin/docker
ADD --chown=root:root bin/kubectl /usr/bin/kubectl
ADD --chown=root:root bin/helm /usr/bin/helm

COPY --chown=root:root bin/.docker /root/.docker
COPY --chown=root:root bin/.kube /root/.kube
COPY --chown=root:root bin/.ssh /root/.ssh
COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx

RUN chmod +x /usr/bin/docker /usr/bin/kubectl /usr/bin/helm && chmod 600 /root/.kube/config

ENV PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

WORKDIR /home/jenkins/agent